package com.JDK新特性;

public class Something
{

    Something()
    {
    }

    Something(String something)
    {
        System.out.println(something);
    }

    // static methods
    static String startsWith(String s)
    {
        return String.valueOf(s.charAt(0));
    }

    // object methods
    String endWith(String s)
    {
        return String.valueOf(s.charAt(s.length() - 1));
    }

    void endWith()
    {
    }

    public static void main(String[] args)
    {
        // static methods
//        IConvert<String, String> convert = Something::startsWith;
//        String converted = convert.convert("a123");
//        System.out.println(converted);


// object methods
        Something something = new Something();
        IConvert<String, String> converter = something::endWith;
        String converted = converter.convert("Java");
                System.out.println(converted);
    }

}

@FunctionalInterface
interface IConvert<F, T>
{
    T convert(F form);
}
